// SPDX-License-Identifier: GPL-2.0-only
/* vendor_hook.c
 *
 * Vendor Hook Support
 *
 * Copyright (C) 2020 Google, Inc.
 */

#define CREATE_TRACE_POINTS
#include <trace/hooks/vendor_hooks.h>
#include <trace/hooks/bonding.h>
#include <trace/hooks/libata.h>
#include <trace/hooks/spinor.h>
#include <trace/hooks/igb.h>
#include <trace/hooks/i40e.h>
#include <trace/hooks/inet.h>
#include <trace/hooks/mmc.h>
#include <trace/hooks/usbxhci.h>
#include <trace/hooks/cdc_ncm.h>
#include <trace/hooks/usbnet.h>
#include <trace/hooks/usb_class.h>
#include <trace/hooks/usb_serial.h>
#include <trace/hooks/usb_storage.h>
#include <trace/hooks/usb_core.h>

/*
 * Export tracepoints that act as a bare tracehook (ie: have no trace event
 * associated with them) to allow external modules to probe them.
 */

#ifdef CONFIG_VENDOR_BOND_HOOKS
EXPORT_HOOK_SYMBOL_GPL(vendor_bond_check_dev_link);
#endif
#ifdef CONFIG_VENDOR_LIBATA_HOOKS
/* power on/off sata */
EXPORT_HOOK_SYMBOL_GPL(vendor_sata_reset);
#endif

#ifdef CONFIG_VENDOR_SPINOR_HOOKS
/* change erase size by wanted_size */
EXPORT_HOOK_SYMBOL_GPL(vendor_spinor_erase_size);
/* return default info table to do sfdp */
EXPORT_HOOK_SYMBOL_GPL(vendor_spi_nor_read_id);
EXPORT_HOOK_SYMBOL_GPL(vendor_spi_nor_read_id_fixup);
EXPORT_HOOK_SYMBOL_GPL(vendor_spi_nor_set_addr_width);
EXPORT_HOOK_SYMBOL_GPL(vendor_spi_nor_parse_4bait);
EXPORT_HOOK_SYMBOL_GPL(vendor_spi_nor_read_sfdp);
#endif

#ifdef CONFIG_VENDOR_IGB_HOOKS
EXPORT_HOOK_SYMBOL_GPL(vendor_igb_init);
EXPORT_HOOK_SYMBOL_GPL(vendor_igb_random_mac);
EXPORT_HOOK_SYMBOL_GPL(vendor_igb_eth_name);
EXPORT_HOOK_SYMBOL_GPL(vendor_igb_remove);
EXPORT_HOOK_SYMBOL_GPL(vendor_igb_open);
EXPORT_HOOK_SYMBOL_GPL(vendor_igb_close);
EXPORT_HOOK_SYMBOL_GPL(vendor_igb_get_skb);
EXPORT_HOOK_SYMBOL_GPL(vendor_igb_ioctl);
EXPORT_HOOK_SYMBOL_GPL(vendor_igb_set_spd_dplx);
EXPORT_HOOK_SYMBOL_GPL(vendor_igb_phy_force_speed_duplex_setup);
#endif

#ifdef CONFIG_VENDOR_I40E_HOOKS
EXPORT_HOOK_SYMBOL_GPL(vendor_i40e_rebuild);
EXPORT_HOOK_SYMBOL_GPL(vendor_i40e_netdev_stats);
#endif

#ifdef CONFIG_VENDOR_INET_HOOKS
EXPORT_HOOK_SYMBOL_GPL(vendor_ip_finish_output);
#endif

#ifdef CONFIG_VENDOR_MMC_HOOKS
EXPORT_HOOK_SYMBOL_GPL(vendor_mmc_init_card);
EXPORT_HOOK_SYMBOL_GPL(vendor_dwmmc_set_cmd_flags);
EXPORT_HOOK_SYMBOL_GPL(vendor_dwmmc_mci_get_cd);
EXPORT_HOOK_SYMBOL_GPL(vendor_dwmmc_state_set_drto);
EXPORT_HOOK_SYMBOL_GPL(vendor_dwmmc_mci_handle_cd);
EXPORT_HOOK_SYMBOL_GPL(vendor_dwmmc_mci_err_handle);
EXPORT_HOOK_SYMBOL_GPL(vendor_dwmmc_cd_int_enable);
EXPORT_HOOK_SYMBOL_GPL(vendor_mmc_is_probe);
EXPORT_HOOK_SYMBOL_GPL(vendor_dwmmc_get_busy_mask);
#endif

#ifdef CONFIG_VENDOR_USBXHCI_HOOKS
EXPORT_HOOK_SYMBOL_GPL(vendor_usb_ignore_babble_err);
EXPORT_HOOK_SYMBOL_GPL(vendor_usb_get_u3_port_status);
EXPORT_HOOK_SYMBOL_GPL(vendor_usb_parse_frame_interval);
EXPORT_HOOK_SYMBOL_GPL(vendor_usb_endpoint_init);
EXPORT_HOOK_SYMBOL_GPL(vendor_xhci_pci_quirks);
#endif

#ifdef CONFIG_VENDOR_CDC_NCM_HOOKS
EXPORT_HOOK_SYMBOL_GPL(vendor_cdc_ncm_cp_netname);
EXPORT_HOOK_SYMBOL_GPL(vendor_cdc_ncm_update_drvflags);
EXPORT_HOOK_SYMBOL_GPL(vendor_cdc_ncm_burst_mode_init);
EXPORT_HOOK_SYMBOL_GPL(vendor_cdc_ncm_rxrestore);
EXPORT_HOOK_SYMBOL_GPL(vendor_cdc_ncm_return_burst);
#endif

#ifdef CONFIG_VENDOR_USBNET_HOOKS
EXPORT_HOOK_SYMBOL_GPL(vendor_usbnet_devnotify);
EXPORT_HOOK_SYMBOL_GPL(vendor_usbnet_bind);
EXPORT_HOOK_SYMBOL_GPL(vendor_usbnet_rxrestore);
EXPORT_HOOK_SYMBOL_GPL(vendor_usbnet_alloc_etherdev);
EXPORT_HOOK_SYMBOL_GPL(vendor_usbnet_dfx);
EXPORT_HOOK_SYMBOL_GPL(vendor_usbnet_update_qlen);
EXPORT_HOOK_SYMBOL_GPL(vendor_usbnet_need_rxsubmit);
EXPORT_HOOK_SYMBOL_GPL(vendor_usbnet_get_reserved_info);
EXPORT_HOOK_SYMBOL_GPL(vendor_set_netdevice_name);
#endif

#ifdef CONFIG_VENDOR_USBLP_HOOKS
EXPORT_HOOK_SYMBOL_GPL(vendor_acm_get_hw_info);
EXPORT_HOOK_SYMBOL_GPL(vendor_usblp_get_hw_info);
EXPORT_HOOK_SYMBOL_GPL(vendor_acm_tty_action);
EXPORT_HOOK_SYMBOL_GPL(vendor_usblp_action);
#endif

#ifdef CONFIG_VENDOR_USB_SERIAL_HOOKS
EXPORT_HOOK_SYMBOL_GPL(vendor_usb_serial_minor_check);
EXPORT_HOOK_SYMBOL_GPL(vendor_usb_serial_minor_state_check);
EXPORT_HOOK_SYMBOL_GPL(vendor_option_init_termios);
EXPORT_HOOK_SYMBOL_GPL(vendor_usb_serial_info);
EXPORT_HOOK_SYMBOL_GPL(vendor_usb_serial_action);
EXPORT_HOOK_SYMBOL_GPL(vendor_usb_wwan_zlp_process);
#endif

#ifdef CONFIG_VENDOR_USB_STORAGE_HOOKS
EXPORT_HOOK_SYMBOL_GPL(vendor_usb_storage_huawei_init);
EXPORT_HOOK_SYMBOL_GPL(vendor_usb_storage_zowee_init);
#endif

#ifdef CONFIG_VENDOR_USB_CORE_HOOKS
EXPORT_HOOK_SYMBOL_GPL(vendor_usb_state_notify);
EXPORT_HOOK_SYMBOL_GPL(vendor_hub_work_queue_process);
EXPORT_HOOK_SYMBOL_GPL(vendor_hub_work_queue_backup);
EXPORT_HOOK_SYMBOL_GPL(vendor_hub_port_ont);
#endif
